import { Suspense } from 'react'
import loadable from '@loadable/component'
import BlankLayout from '@/layout/BlankLayout'
const modules = import.meta.glob('../views/**/*.tsx')


function LazyLoad(url: string) {
  if(!url) return <BlankLayout />
  //@ts-ignore
  const ComponentNode = loadable(async () => {
    return modules[`../views${url}.tsx`]()
  })
  return (
    <Suspense>
      <ComponentNode />
    </Suspense>
  )
}

export default LazyLoad
